using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class UpgradeLongLastingProjectile:Upgrade {

	Projectile[] projectiles = new Projectile[3];

	protected override void ProjectileFiringEventHandler(object _sender,ProjectileEventArgs e) {

		if(!IfReactProjectileEvent(_sender,e)) return;
		Projectile sender = _sender as Projectile;

		bool slotEmpty = false;
		for(int i = 0;i<3;i++) {
			if(!projectiles[i]||projectiles[i].gameObject.activeSelf==false) {
				projectiles[i]=sender;
				slotEmpty=true;
				break;
			}
		}
		if(!slotEmpty) {
			projectiles[0].gameObject.SetActive(false);
			projectiles[0]=projectiles[1];
			projectiles[1]=projectiles[2];
			projectiles[2]=sender;
		}

		base.ProjectileFiringEventHandler(sender,e);
	}

}